/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import Entity.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import library.Koneksi;
import library.NamaLab;
import library.StatusSidang;

/**
 *
 * @author mr2
 */
public class main {
    
    public static void main(String args[]){
        
        /*SidangTAModel modelTA = new SidangTAModel();
        List<SidangTA> listPendaftar = modelTA.ListPendaftarSidang();
        listPendaftar = modelTA.ListPendaftarSidang();*/
        
        /*String id_user = "5208100043";
        SidangTAModel DetailPendaftarSidang = new SidangTAModel();
        SidangTA DetailPendaftar = DetailPendaftarSidang.KoorTADetailPendaftarSidang(id_user);*/
        
        /*LabModel lab = new LabModel();
        List<Lab> listlab = lab.ListLab();
        if(listlab.size() < 1){
            
        }
        for(int i=0; i < listlab.size(); i++){
            System.out.println(listlab.get(i).getNamaLab());
        }*/
        
        /*String id_user = "5208100001";
        
        SidangTAModel StatusTA = new SidangTAModel();
        SidangTA statusTA = StatusTA.getStatusTAMahasiswa(id_user);
        
        System.out.println(statusTA.getJenisSidang());*/
        
        /*StatusKoorTAModel statusKoorTA = new StatusKoorTAModel();
        List<StatusKoorTA> status = statusKoorTA.ListStatusKoorTA();
        if(status.size() < 1){
            
        }
        for(int i=0; i < status.size(); i++){
            System.out.println(status.get(i).getStatusKoorTA());
        }*/
        
        //StatusDaftarTAModel statusDaftar = new StatusDaftarTAModel();
        //List<StatusDaftarTA> statusDaftarTA = statusDaftar.ListStatusDaftarTA();
        
        /*SidangTAModel Jadwal = new SidangTAModel();
        List<SidangTA> listJadwal = Jadwal.ListJadwal("SIDANG PROPOSAL", "SPK");
        
        if(listJadwal.size() < 1){
            
        }
        for(int i=0; i < listJadwal.size(); i++){
            System.out.println(listJadwal.get(i).getKoorTAStatusProposal());
        }*/
        
        /*SidangTAModel PPSI = new SidangTAModel();
        List<SidangTA> ListPPSI = PPSI.PPSIListJadwal();
        
        if(ListPPSI.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < ListPPSI.size(); i++){
            System.out.println(ListPPSI.get(i).getProposalWKTSidang());
        }
        
        String sql = "SELECT id_user, proposal_tgl_sidang, proposal_tempat_sidang, proposal_waktu_sidang "
                    + "FROM sidang_ta "
                    + "WHERE PROPOSAL_STATUS_KOOR_TA = 'OK' OR PROGRESS_STATUS_KOOR_TA = 'OK' OR FINAL_STATUS_KOOR_TA = 'OK' "
                    + "AND lab = 'PPSI' LIMIT 0 , 30";
        
        System.out.println(sql);*/
        /*DosenModel a = new DosenModel();
        List<Dosen> listDosen = new ArrayList();
        listDosen = a.ListNamaDosen();
        if(listDosen.size() < 1){
            
        }
        for(int i=0; i < listDosen.size(); i++){
            System.out.println(listDosen.get(i).getUser().getNamaUser());
        }*/
        
        //System.out.println(DetailPendaftar.getJudul());
        
        /*Connection koneksi = koneksi = KoneksiDB.getKoneksi();
        String id_user = "5208100043";
        PreparedStatement prepare = null;
        ResultSet result = null;
       
        String statusDaftarFinal = "";
        
        try {
               
            String sql = "select jenis_sidang from sidang_ta "
                       + "where jenis_sidang = 'SIDANG FINAL' and  id_user = "+id_user;        
            prepare = koneksi.prepareStatement(sql);                
            result = prepare.executeQuery();
            
            if(result.next()){                                                     
               statusDaftarFinal = "SUDAH DAFTAR FINAL";
            }else{
               statusDaftarFinal = "BELUM DAFTAR FINAL";
            }
                    
        } catch (SQLException ex) {
            System.out.println(ex.getMessage()); 
        }
        System.out.println(statusDaftarFinal); */
        
        /*DosenModel dosen = new DosenModel();
        Dosen detailDosen = dosen.DetailDosen();
        
        System.out.println(detailDosen.getUser().getNamaUser());*/
        
        /*DosenModel dosen = new DosenModel();
        List<Dosen> listdosen = dosen.ListNamaDosen();
        
        //listDosen = a.ListNamaDosen();
        if(listdosen.size() < 1){
            
        }
        for(int i=0; i < listdosen.size(); i++){
            System.out.println(listdosen.get(i).getUser().getNamaUser());
        }*/
        
        /*String id_user = "5208100001";
        SidangTAModel DetailPendaftarSidang = new SidangTAModel();       
        SidangTA DetailPendaftar = DetailPendaftarSidang.DetailPendaftarSidang(id_user);
        
        System.out.println(DetailPendaftar.getJenisSidang());*/
        
        /*Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        String d = c.get(Calendar.YEAR) + "-" + c.get(Calendar.MONTH) + "-" + c.get(Calendar.DATE);
        
        Calendar cal = Calendar.getInstance();
        String DATE_FORMAT_NOW = "yyyy-MM-dd";
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
        String a = sdf.format(cal.getTime());
        
        System.out.println(a);
        
        System.out.println(d);*/
        
        /*String role = "Laboran PPSI";
        String lab = "";
        String jenisSidang = "SIDANG PROPOSAL";
        
        if(role.equals("Laboran PPSI")){
            lab = "PPSI";
        }else if(role.equals("Laboran SPK")){
            lab = "SPK";
        }else{
            lab = "EBISNIS";
        }
        
        SidangTA sidangta = new SidangTA();
        sidangta.setJenisSidang(jenisSidang);
        sidangta.setLab(lab);
        
        SidangTAModel Jadwal = new SidangTAModel();
        //List<SidangTA> listJadwal = Jadwal.ListJadwal(jenisSidang, lab);
        List<SidangTA> listJadwal = Jadwal.ListJadwal(sidangta);
        
        if(listJadwal.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listJadwal.size(); i++){
            System.out.println(listJadwal.get(i).getProposalTempatSidang());
        }*/
        
        /*StatusSidang proposal = new StatusSidang();
        List<StatusSidang> listStatusProposal = proposal.StatusSidangFinal();
        
        //listDosen = a.ListNamaDosen();
        if(listStatusProposal.size() < 1){
            
        }
        for(int i=0; i < listStatusProposal.size(); i++){
            System.out.println(listStatusProposal.get(i).getStatusFinal());
        }*/
        
        /*String idUser = "5208100043";
        SidangTAModel detail = new SidangTAModel();
        SidangTA DetailTA = detail.getInfoTA(idUser);
        
        //System.out.println(DetailTA.getUser().getIdUser());
        //System.out.println(DetailTA.getUser().getNamaUser());
        System.out.println(DetailTA.getJudul());*/
        
        /*NamaLab namaLab = new NamaLab();
        List<NamaLab> listlab = namaLab.ListLab();
        
        if(listlab.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listlab.size(); i++){
            System.out.println(listlab.get(i).getNamaLab());
        }*/
        
        /*SidangTA sidangta = new SidangTA();
        sidangta.setJenisSidang("SIDANG PROPOSAL");
        sidangta.setLab("PPSI");
        JadwalSidangTAModel Jadwal = new JadwalSidangTAModel();
        List<SidangTA> listJadwalProposal = Jadwal.ListJadwalProposal(sidangta);
        List<SidangTA> listJadwalProgress = Jadwal.ListJadwalProgress(sidangta);
        List<SidangTA> listJadwalFinal = Jadwal.ListJadwalFinal(sidangta);
        
        if(listJadwalProposal.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listJadwalProposal.size(); i++){
            System.out.println(listJadwalProposal.get(i).getProposalTGLSidang());
        }*/
        
        /*String id_user = "5208100043";
        SidangTAModel detail = new SidangTAModel();
        SidangTA detailJadwalProposal = detail.getDetailProposal(id_user);
        
        System.out.println(detailJadwalProposal.getUser().getIdUser());*/
        
        /*String idUser = "5208100044";
        
        SidangTAModel detail = new SidangTAModel();
        SidangTA detailJadwalProposal = detail.getDetailProposal(idUser);
        
        System.out.println(detailJadwalProposal.getUser().getIdUser());
        System.out.println(detailJadwalProposal.getProposalTempatSidang());*/
        
        /*String idUser = "5208100090";
        SidangTAModel beritaAcara = new SidangTAModel(); 
        SidangTA detailProposal = beritaAcara.getDetailProposal(idUser);
        
        System.out.println(detailProposal.getProposalTempatSidang());*/
        
        /*DosenModel dosen = new DosenModel();
        List<Dosen> listPembimbing1 = dosen.ListPembimbing1();
         if(listPembimbing1.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listPembimbing1.size(); i++){
            System.out.println(listPembimbing1.get(i).getUser().getNamaUser());
        }*/
        
        /*String idUser = "5208100043";
        int idPendaftar = 0;
        SidangTAModel infoTA = new SidangTAModel();
        int idPendaftaran = infoTA.getInfoTA(idUser).getId_pendaftaran();
        
        if(idPendaftaran != 0){
            idPendaftar = idPendaftaran;
        }else{
            idPendaftar = 0;
        }
        
        System.out.println(idPendaftar);*/
        
        /*String idDosen = "197103132009121000";
        BimbinganTAModel bimbinganTA = new BimbinganTAModel();
        List<SidangTA> listMhsBimbingan = bimbinganTA.ListMhsBimbingan(idDosen);
        
        if(listMhsBimbingan.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listMhsBimbingan.size(); i++){
            System.out.println(listMhsBimbingan.get(i).getUser().getIdUser());
        }*/
        
        /*String idDosen = "197103132009121000";
        String idMahasiswa = "5208100050";
        BimbinganTAModel bimbinganTA = new BimbinganTAModel();
        List<BimbinganTA> listBimbinganTA = bimbinganTA.DosenListBimbinganTAMhs(idDosen, idMahasiswa);
        
        if(listBimbinganTA.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < listBimbinganTA.size(); i++){
            System.out.println(listBimbinganTA.get(i).getJudulBimbingan());
        }*/
        
        /*String status = "LULUS";
        String tglAwal = "2012-09-10";
        String tglAkhir = "2012-09-16";
        
        BeritaAcaraTAModel beritaAcara = new BeritaAcaraTAModel();
        List<SidangTA> rekapFinal = beritaAcara.RekapBeritaAcaraFinal(status, tglAwal, tglAkhir);
        
        if(rekapFinal.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < rekapFinal.size(); i++){
            System.out.println(rekapFinal.get(i).getLab());
        }*/
        
        /*String idBerita = "3";
        int idberita = Integer.parseInt(idBerita);
        
        BeritaTA beritaTA = new BeritaTA();
        BeritaTAModel berita = new BeritaTAModel();
        
        beritaTA.setIdBerita(idberita);
        
        BeritaTA detailBerita = berita.DetailBerita(beritaTA);
        
        System.out.println(detailBerita.getJudulBerita());
        System.out.println(beritaTA.getIdBerita());*/
        
        /*String status = "BELUM";
        String tglAwal = "2012-09-01";
        String tglAkhir = "2012-12-01";
        String jenisSidang = "SIDANG PROGRESS";
        
        BeritaAcaraTAModel beritaAcara = new BeritaAcaraTAModel();
        //List<SidangTA> rekapProposal = beritaAcara.RekapBeritaAcaraProposal(status, tglAwal, tglAkhir);
        List<SidangTA> rekapProgress = beritaAcara.RekapBeritaAcara(jenisSidang, status, tglAwal, tglAkhir);
        //List<SidangTA> rekapFinal = beritaAcara.RekapBeritaAcaraFinal(status, tglAwal, tglAkhir);
        
        if(rekapProgress.size() < 1){
            System.out.println("kosong");
        }
        for(int i=0; i < rekapProgress.size(); i++){
            System.out.println(rekapProgress.get(i).getProgressTGLSidang());
        }*/
        
//        Calendar calNow = Calendar.getInstance();
//        calNow.set(Calendar.YEAR, 2013);
//        calNow.set(Calendar.MONTH, 11);
//        calNow.set(Calendar.DATE, 24);
//        Calendar cal = Calendar.getInstance();
//        cal.set(Calendar.YEAR, 2012);
//        cal.set(Calendar.MONTH, 2);
//        cal.set(Calendar.DATE, 24);
//        String DATE_FORMAT_NOW = "yyyy-MM-dd";
//        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
//        String periode = null;
//        
//        BimbinganTAModel bimbingan = new BimbinganTAModel();
//        ArrayList rataJlhBimbinganPerPeriod = new ArrayList();
//        
//        
////        System.out.println(cal.getTime());
//        
//        for(cal.getTime(); cal.getTime().compareTo(calNow.getTime()) < 0; cal.add(Calendar.MONTH, 6) ){
//            
//            System.out.println(cal.getTime());
//            if(cal.get(Calendar.MONTH) == 2){
//                System.out.println("GASAL "+cal.get(Calendar.YEAR));
//            }else{
//                System.out.println("GENAP "+cal.get(Calendar.YEAR));
//            }
//            
//            periode = sdf.format(cal.getTime());
//            System.out.println(periode);
//            
//            double RataJLHMhsPerDosen = bimbingan.RataJLHMhsBimPerPeriode(periode);
//            System.out.println(RataJLHMhsPerDosen);
//            
//            Map map = new HashMap();
//            map.put("periode", periode);
//            map.put("RataJLHMhsPerDosen", RataJLHMhsPerDosen);
//            
//            rataJlhBimbinganPerPeriod.add(map);
//        }
        
//        DosenModel dosen = new DosenModel();
//        List<Dosen> listdosen = dosen.ListPembimbing();
//        
//        if(listdosen.size() < 1){
//            
//        }
//        for(int i=0; i < listdosen.size(); i++){
//            System.out.println(listdosen.get(i).getUser().getNamaUser());
//        }
        
//        PendaftaranSidangTAModel pendaftar = new PendaftaranSidangTAModel();
//        //List<SidangTA> listJadwal = Jadwal.ListJadwal(jenisSidang, lab);
//        List<Sidang> listPendaftar = pendaftar.ListPendaftarSidang("SIDANG PROPOSAL");
//        
//        if(listPendaftar.size() < 1){
//            System.out.println("kosong");
//        }
//        for(int i=0; i < listPendaftar.size(); i++){
//            System.out.println(listPendaftar.get(i).getTa().getUser().getIdUser());
//        }
        
        
//        SidangTAModel Detail = new SidangTAModel();
//        Sidang sidang = new Sidang();
//        sidang.setIdSidang(4);
//        Sidang DetailSidang = Detail.getDetailSidang(sidang);
//        
//        System.out.println(DetailSidang.getPenguji1());
        
//        Connection koneksi;
//        koneksi = KoneksiDB.getKoneksi();
//        
//        PreparedStatement prepare = null;
//        ResultSet result = null;
//        
//        ArrayList<Sidang> listPendaftar = new ArrayList<Sidang>();
//        String sql = null;
//        
//        String jenisSidang = "SIDANG PROPOSAL";
//        
//        try{
//                    
//            sql = "SELECT id_progress, ta_progress.id_ta, ta.id_user, ta.nama_lab, status_daftar_progress "
//            + "FROM ta_progress, ta "
//            + "WHERE ta.id_ta = ta_progress.id_ta and ta.status_ta = '1' ";
//
//            prepare = koneksi.prepareStatement(sql);
//            result = prepare.executeQuery();
//
//            while(result.next()){
//                User user = new User();
//                user.setIdUser(result.getString("id_user"));
//                
//                TA ta = new TA();
//                ta.setUser(user);
//                ta.setNamaLab(result.getString("nama_lab"));
//                ta.setIdTA(result.getInt("id_ta"));
//                
//                Sidang sidang = new Sidang();
//                sidang.setTa(ta);
//                sidang.setIdSidang(result.getInt("id_progress"));
//                sidang.setStatusDaftarSidang(result.getString("status_daftar_progress"));
//                
//                listPendaftar.add(sidang);
////                System.out.println(sidang.getTa().getUser().getIdUser()+" | "+sidang.getTa().getNamaLab()+" | "+sidang.getTa().getIdTA()+" | "+sidang.getIdSidang()+ " | "+sidang.getStatusDaftarSidang() );
//            }
//
//        }catch(SQLException ex){
//            System.out.println(ex.getMessage());
//        }finally{
//            if(prepare != null){
//                try{
//                    prepare.close();
//                }catch(SQLException ex){
//                    System.out.println(ex.getMessage());
//                }
//            }
//            if(result != null){
//                try{
//                    result.close();
//                }catch(SQLException ex){
//                    System.out.println(ex.getMessage());
//                }
//            }
//        }
//        
//        if(listPendaftar.size() < 1){
//            System.out.println("kosong");
//        }
//        for(int i=0; i < listPendaftar.size(); i++){
//            System.out.println(listPendaftar.get(i).getTa().getUser().getIdUser());
//        }
        
//        YudisiumModel periode = new YudisiumModel();
//        List<Yudisium> periodeYudisium = periode.ListYudisium(0);
//        
//        for(int i=0; i < periodeYudisium.size(); i++){
//            System.out.println(periodeYudisium.get(i).getPeriode()+"||"+periodeYudisium.get(i).getTglMulai()+"||"+periodeYudisium.get(i).getTglAkhir());
//        }
        
        DosenModel listDosen = new DosenModel();          
            List<Dosen> pembimbing = listDosen.ListPembimbing();
        
        for(int i=0; i < pembimbing.size(); i++){
            System.out.println(pembimbing.get(i).getUser().getIdUser()+"||"+pembimbing.get(i).getUser().getNamaUser());
        }
        
    }
    
    
    
}
